<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>演示跨域问题</title>
</head>
<body>
	<button onclick="getHello()">获取欢迎信息</button>

	<script type="text/javascript" >
		function getHello(){
			const xhr = new XMLHttpRequest()
			xhr.onreadystatechange = ()=>{
				if(xhr.readyState === 4){
					if(xhr.status >= 200 && xhr.status <= 299){
						console.log('请求成功了',xhr.response)
					}
				}
			}
			xhr.open('GET','http://localhost:5001/hello')
			xhr.send()
		}
	</script>
</body>
</html>